UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC
Well it’s been a nightmare few days with the upgrade to Lion GM breaking Samba sharing. For me NFS isnt really an option, it’s clunky, and my network is full of old windows machines, not to mention the XBMC’s on the Apple TV 2, Ipad 2, iPhone and the old Xboxs. i needed a fix for Samba, and this came in the form of installing Samba 3 on Lion via Macports and setting up the smb.conf file manually to share my media.
This text is partly my own work and partly complied from other tutorials.
You will need a copy of Lion GM installed on your mac, along with a copy of xcode 4.1 (available from a lot of places, legitimate or otherwise). You will then also install first macports and then samba 3 via terminal, but most of this stuff is copy & paste. Finally, I’d install a copy of Textwrangler for mac. It will let you edit files in its text editor without using the command line, which is much easier, and will let you unlock & authenticate to save/open files anywhere in the filesystem.
First, install Xcode 4.1 (DP7 or GM is needed currently).
Second, install MacPorts from SVN using these directions taken from macports site
Check out MacPorts source
In Terminal, one line at a time
sudo mkdir -p /opt/mports
sudo cd /opt/mports
sudo svn checkout http://svn.macports.org/repository/macports/trunk
Build and Install MacPorts
MacPorts uses autoconf and makefiles for installation. These commands will build and install MacPorts to /opt/local. I ran all these with the sudo command before them to avoid permissions problems
sudo cd /opt/mports/trunk/base
sudo ./configure --enable-readline
sudo make
sudo make install
sudo make distclean
Open /opt/local/etc/macports/sources.conf in a text editor. The last line which should look like this:
rsync://rsync.macports.org/release/ports/
Change it to point to the working copy you checked out:
file:///opt/mports/trunk/dports
Now MacPorts will look for portfiles in the working copy.
After installing MacPorts, you may need to add it to your PATH, so go ahead and run in terminal:
export PATH=$PATH:/opt/local/bin
and then
sudo port -d sync
This will make sure that it is added to your path, and you shouldn’t have to specify full paths to binaries. The second command tells macports to download the latest versions of the portfiles (instructions for macports on installing a program)
Once everything with macports is finished setting up, open up a terminal window and type
sudo port install samba3
It’ll automatically install samba 3 and all of its dependencies.
Now to edit the configuration! It’s pretty straight forward if you read through the config file located at /opt/local/etc/samba3/smb.conf (it’s callend smb.conf.sample, just remove the .sample from the filename and open with textwrangler).
Your shares should look something like this (you can have as many as you like):
[Downloads]
comment = Downloads
path = /Users/jodsclass/Downloads
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
[Movies]
comment = Movies
path = /Volumes/MyBook/Movies
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
[TV]
comment = TV
path = /Volumes/MyBook/TV Shows
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
Also, remember to change your workgroup name to match the rest of the machines on your network, mine are all on workgroup so mine looks like
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP
And the name of my mac is imac so my server string is
# server string is the equivalent of the NT Description field
server string = imac
(that way SMB shares can be accessed at smb://imac instead of using IP based). You can leave the rest of the config file commented out.
All that’s left now is to do
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
(I’m using full paths so we dont accidentally start up the apple supplied smb server ) and samba will be up and running. The only downside I’ve found is that you do need to remember to start samba every time you reboot (the “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” commands).
You can use the following launchagent to start the samba server everytime your machine restarts.
Download mine here and put it in /Library/LaunchAgents, and it should automatically start up samba for you.
Now in XBMC just add your samba shares as follows.
smb://imac (or whatever your machine is called in the server string above)
NOTE: Please remember to turn off SMB sharing in settings>sharing>File Sharing as the built in OSX Lion SMB implementation will clash with the one you installed via Macports
If you found this post helpful why not help out my business and buy some geek badges from our site π
UPDATE – I’ve found a much better fix – Use NFS shares instead- Use NFS shares instead of Samba with XBMC
Thanks for posting this information. I want to upgrade to Lion but am running a samba dependent Addonics NAS adapter (with attached HDD) so am hoping to replicate the steps that you’ve outlined. I have a couple of questions. Is this likely to work on the final release of Lion?
Also, your instructions are very clear but I get lost when I get to the following section:
Also, remember to change your workgroup name to match the rest of the machines on your network, mine are all on workgroup so mine looks like
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP
And the name of my mac i imac so my server string is
# server string is the equivalent of the NT Description field
server string = imac
Where are you accessing/editing this information (your comments about #workgroup and # server string)?
Apologies but this kind of thing is new to me!
Thanks
Hi.
Yes this will work in the released version of Lion, I completed these steps on the GM version which is essentially the release version (same build number).
With regards to where I’m editing, it is in the samba config file (where you add the shares). It is in the folder mentioned above. Simply browse to it and open the samba config file and you will see the lines I’m suggesting to edit.
Hello.
Thanks for the tutorial.Γ followed the steps and get
sudo: ./configure: command not found
when i give the second command on the 2 group
“sudo ./configure βenable-readline”
What am I doing wrong … Really noob here .
Thanks
Try it without the sudo command, and ensure you have changed directory (CD) inot the right directory
cd /opt/mports/trunk/base
Do you think it’s likely that someone will build a Samba installer for Lion that is current, without the need to muck about with Mac Ports etc?
I still can’t see why Apple would remove it. What dumb f*cks.
Possibly
Samba is still there but it’s implemented slightly differently to the old version. The difference is to do with authentication.
Perhaps apple will roll out a fix, but it was suggested they where dropping samba altogether.
Correctly done everything but it seems it doesn’t start the smbd and nmbd… smb.conf is correct and any other part went good… any idea?
Thanks so very much for this. I upgraded my parents’ media server Mac mini on a whim, and this helped me get it back up and running. I really appreciate your having taken the time to write all these down step by step.
A quick suggestion: consider putting the port install samba3 instruction on its own line? I almost missed it. (And maybe put the command line instructions in code tags, or some fixed-width font, for clarity.)
Thanks again.
Glad it worked for you. I’ll try and add in some code tags later. I did the blog post quickly as soon as I solved my own samba woes in the GM release. Now that lion has been released so many people are asking questions.
Try starting them from terminal with the command I put in the post.
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
Hello John .
I followed all the instructions and I think I have SMB working .
I got xbmc to see and try to mount the volume I added .
But , it asks for a user and passwd that i cannot seem to get working.
CanT i just use the workgroup WORKGROUP as it is defined in XMBC Samba settings and not have it to ask user and passed ?
Also , how do I start and restart the smb server ?
Thanks again.
Nuno
Thanks a lot
Hello,
thanks!! worked perfect for me!!
The only problem is that I have to start smbd and nmbd from command line, because the LaunchAgent doesn’t seem to work for me, any idea?
Thanks!!
Yeah the Launch Agent isn’t working quite right for me either, working on a fix when I get chance, will update once ready.
Hi again.
It seems the sbmd log gives this
[2011/07/22 18:16:27, 0] smbd/service.c:set_current_service(191)
chdir (/Users/nsousa/Downloads) failed
Although the configuration is ok.
Any ideas ?
when opening a terminal window if I give that command I get
issete:base nsousa$ chdir
-bash: chdir: command not found
Thanks
I apologize for the lack of knowledge here ….but I am trying…
Works perfect, after a few hiccups. Worked through them though. Thanks.
I got it working at startup with Lingon:
http://www.peterborgapps.com/lingon/
It was open source but now you have to pay for it in the AppStore. Fortunatelly it’s still on Sourceforge:
http://sourceforge.net/projects/lingon/files/Lingon/2.1.1/Lingon-2.1.1.zip/download
With Lingon you can set up a new Launch Agent with the command line for Terminal. I tried it and it started samba. At first my mac didn’t come up with my desktop, but it rebooted automatically and then it worked.
Many thanks. I’ll give it a try later today. Glad you got it up and running.
Thanks a lot for your detailed description. You saved me a lot of time.
Hint: If you want to migrate your old shares: you can find them in /var/db/samba/smb.shares
I think I know what the issue with the LaunchAgent is. You are missing a KeepAlive key from it. I did exactly what Sebastian did, which is to use Lignon to create a LaunchAgent. Here’s the code for my one. Simply pop it in a file and place in /Library/LaunchDaemons and then reboot.
I’ve rebooted my machine a few times and checked things are running by dropping into terminal and issuing this command:
ps -ac | grep sm
You should then see the path to nmdb and smbd listed, indicating it is running the items
Here’s the launch agent code:
KeepAlive
Label
com.imac.samba3launcher
ProgramArguments
/opt/local/sbin/smbd
-D
&&
sudo
/opt/local/sbin/nmbd
-D
RunAtLoad
Ok, spot the fool who does not know how to post things properly!
Here is a paste bin link to the LaunchAgent:
http://pastebin.com/BwspPNN1
Thanks Marcus. I’ll update the blog entry when I get home.
John,
Thanks mate, I owe you a beer!
Hehe I’ll take a beer.
No problem at all. Massive thanks to you for putting the information up!
hi John,
thanks for this comprehensive fix. it worked for me but just wanted to ask about the LaunchAgent. by placing the LaunchAgent in the /Library/LaunchAgents folder, does this mean that samba will start automatically after a reboot? if not, i’d be really grateful if you could tell me how to you use a LaunchAgent.
thank you.
ajmal
Yes, if you place the plist in your launch agents folder it will automaticaly start samba when your machine starts.
Been using samba3 since Lion but noticing buffering lags on my aTV2 (nightly build).
Anybody else bene having buffering issues?
Thx
Had the odd buffer on atv2 xbmc but nothing serious. Maybe 1 buffer per hour of video but my iMac is encoding videos from .mkv to .m4v files to add to iTunes so I thought it was due to disk activity.
Great tutorial! It worked for me at the first attempt.
Thanks
You might want to note that Xcode is now available for free from the App Store.
I’ll update the article to say that, when I wrote it it wasn’t available in the Mac App Store.
In case anybody is interested, I got this to work over WebDAV, including XBMC on Apple TV 2. Using MacPorts to run Samba is a good idea, but I got tired of managing this software a long time ago and didn’t want to go back.
So, I stayed up all night (grrrr) trying different things, including NFS. I could never get past a “permission denied” problem on NFS, but I eventually got WebDAV to work, inspired mostly from this link: http://www.gregwestin.com/webdav_for_ical.php I left out the security access, since I’m inside my own home and protected by an internet firewall. In the end, it’s quite simple and all built into OS X. In fact, it would appear that Apple is really headed in the WebDAV direction (iPhones and iPads and such), so I prefer this solution. It’s fast, too.
Basically, all I did is the following. My media files are all mounted on /Volumes/Media.
1) As root, created /Library/WebServer/Documents/webdav
2) ln -s /Volumes/Media/ /Library/WebServer/Documents/Media
3) Added these lines to /etc/httpd/httpd.conf, just before :
DAVLockDB /Library/WebServer/davlocks/DAVLockDB
DAVMinTimeout 600
DAV On
AllowOverride None
Options None
3) Started web sharing in System Preferences.
4) In XBMC, add a source as “day://:80/webdav/Media/
That’s it… It works great, and I don’t have to mess with anything to do with Windows! π The neat this, too, is that you can also view and play your media files from another web browser go going to “http:///webdav/Media”
Hi, no problem with the installation but now when i try to do
/opt/local/sbin/smbd -D && /opt/local/sbin/nmbd -D
smbd in up but nmbd logs give me this:
[2011/07/24 14:39:34, 0] lib/util_sock.c:open_socket_in(1336)
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
(File Sharing in disabled)
Thank you for the tutorial; it got me up and running with Lion and XBMC. One issue that came up for me, however, is that I get the following log message from log.nmbd when I try to launch it.
macpro:var jeff$ tail -n3 log.nmbd
[2011/07/24 09:43:48, 0] lib/util_sock.c:open_socket_in(1336)
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
It seems to be conflicting with netbiosd
macpro:var jeff$ sudo lsof -i udp | grep netbios-ns
launchd 1 root 13u IPv4 0xffffff80190fdc60 0t0 UDP *:netbios-ns
netbiosd 3462 _netbios 4u IPv4 0xffffff80190fdc60 0t0 UDP *:netbios-ns
But I am stuck as I don’t know how to disable netbiosd, or if I should. If I kill it, it just immediately relaunches.
All that said I am able to connect to my samba shares without it so I am not sure I need to change anything. What do you think?
Great !!!
Thanks for this valuable support…
Works perfect
Thanks
I followed every step but my mac seems to be using the (broken) Lion implementation. I have it deactivated from the settings menu but it still won’t use any of the parameters I set on smb.conf
How can I check which version is in use?
Thanks!
Probably a good workaround, but many users need read/write access of their files, read only will only help for watching remote content, but if you want to delete files from XBMC or similar you won’t be able to.
Hello,
I get stuck at your second group of SSH commands, the “sudo cd /opt/mports/trunk/base” line says “No such file or directory”.
Your tutorial seems to be the only good one online (and thank you), but I just can’t get past one of the first steps… (and really want to get my Apple TV working properly)
Thanks.
i get as I enter 3rd line in Terminal
“svn: Server sent unexpected return value (400 Bad request) in response to OPTIONS request for ‘http://svn.macports.org/repository/macports/trunk'”
Help
Hi, I have this setup on my Imac with Lion, when I try and connect from a widnows 7 machine it requests a user and password, whatever i put in there (or if I leave it bank) it fails to connect, how can I set a user and pw or what do I use?
Thanks
@Sam – I noticed some buffering issues; the REAL difference was when trying to fast-forward (seek/scan) through files. It was clear that there is a performance bottleneck somewhere.
I didn’t use macports, I just DL’d the samba source and compiled it manually (installed into /opt/smb to keep my system clean). I noticed that all of my 10.6 samba config files were left on the system, even through the binaries were removed. I went to my laptop, which is still 10.6, and copied /usr/sbin/smbd, /usr/sbin/nmbd, and /usr/lib/samba over to my Lion system. I renamed smbd to smbd-o and nmbd to nmbd-o so I wouldn’t harm the Lion files. I ran the binary and it worked!! I also see that there aren’t any buffer or seek issues.
The big difference I can see are the VFS dynlibs included with the Apple version of smbd (which is 3.0.26 on my old system). I’m thinking that Apple including some darwin-savvy magic code into their version.
I have the same problem when starting nbmc:
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
I have seen using sudo lsof -i -P that this port is being used by netbios.
Does someone know how can I solve this problem?
Thanks
Hi
These are terminal commands, have you SSH’d into your apple TV 2 to try these?
Make sure you have the command entered correctly. It may also have been a temporary problem with the macports servers
Have you disabled the built in version of samba in Lion? This was the problem with the new version of samba, it required authentication. Make sure you disable the native samba in sharing settings, then restart the version you have installed from this tutorial.
Might be a good idea John, I don’t have access to these files anymore since I upgraded. Could you zip them up and send them to me? jodsclass AT gmail DOT COM
Ensure you have disabled lion’s built in samba as it may be causing a conflict. You may need to retry the tutorial as it sounds like you have a conflict. Also, ensure that you haven’t edited any parts of the smbd.conf which relate to ports & ip binding as this might be misconfigured. Once you have it working with a basic config you can keep editing the file & testing as you go along.
Any ideas on user name and password as above please?
I have disabled the built in SMB (had done this already) and am clueless as to how to set a samba user and password, I found saslpasswd2 and tried to set a user and password but this then doesnt allow login from windows machine, if i try and run listusers i get a check_db unsuccesful error?
Andy
Is it necessary to use this method to install and use MacPorts? Why not install with a package installer and use the official GUI?
http://www.macports.org/install.php
or:
https://trac.macports.org/wiki/MacPortsGUI
I installed MacPorts using their Lion DMG. Now every time I try to run “sudo port -d sync” or “sudo port install samba3” I get “command not found”
When I try “sudo /opt/local/bin/port -d sync” I get:
Warning: No default port source specified in /opt/local/etc/macports/sources.conf, using last source as default
DEBUG: /usr/bin/tar -qxOf {/opt/mports/trunk/dports} +CONTENTS
tar: Error opening archive: Failed to open ‘/opt/mports/trunk/dports’
while executing
“exec /usr/bin/tar -qxOf {/opt/mports/trunk/dports} +CONTENTS”
(“eval” body line 1)
invoked from within
“eval exec $cmdline”
(procedure “macports::fetch_port” line 24)
invoked from within
“macports::fetch_port $path 1”
(procedure “macports::getportdir” line 12)
invoked from within
“macports::getportdir $source”
(procedure “macports::getindex” line 4)
invoked from within
“macports::getindex $source”
(procedure “_mports_load_quickindex” line 11)
invoked from within
“_mports_load_quickindex”
(procedure “mportinit” line 525)
invoked from within
“mportinit ui_options global_options global_variations”
Error: /opt/local/bin/port: Failed to initialize MacPorts, tar: Error opening archive: Failed to open ‘/opt/mports/trunk/dports’
I desperately need to get my Apple TV with Boxee working again, very pissed at Lion for this, wish Apple had made it clear that Lion would break almost all SMB functionalityβ¦
At the time this was written Lion was still in developer preview. Macports was not available for the developer build so needed to be installed & compiled via terminal.
You probably havnet added the executables to your paths. It is better to install it the way I’ve done it. Also opt/local/bin is where we decided to install macports via terminal, does the executable in your .dmg use a different folder? Follow the commands in this tutorial and you should be able to get it to work. Over 4000 people have contacted me to state it works this way so it’s very do’able.
I changed the path to be: file:///opt/local/share/macports
Now it’s partly working, but when I do the sudo port install samba3 command I now get:
Warning: No default port source specified in /opt/local/etc/macports/sources.conf, using last source as default
Warning: port definitions are more than two weeks old, consider using selfupdate
Error: Port samba3 not found
Any ideas?
John… A big big THANKS !! All is ok. Thanks you !!
Thanks for the excellent tutorial, John. I successfully got it running this weekend. For the record, I used the MacPorts 2 Lion .dmg file and did not build from the source and XCode. Given that, I don’t know if XCode is truly necessary (unless MacPorts requires it). My only remaining issue is that launchd doesn’t auto-start Samba with your samba3.plist file (edited for my machine name) and is producing console respawning messages every 10 seconds…I’ll figure that out later. Samba is running fine, though. I can’t thank you enough. My LG BD690 sees and streams from the SMB shares just like before Lion.
can someone post an example of smb.config ?
where i post username , ip e password of my MAC ??
@Andy —
I set a samba password using:
macdaddy:bin jeff$ sudo /opt/local/bin/smbpasswd -a user
It will ask for a password, and from then on you should be able to use it or at least it worked for me for a username that matched my username.
I keep getting this error when trying to install Macports…help..
“svn: OPTIONS of ‘http://svn.macports.org/repository/macports/trunk’: could not connect to server (http://svn.macports.org)”
One key element in getting this to work is to add the user using SMBPASSWD -a *****
If you don’t do this u will not be able to connect from Windows 7, because it’s just giving you a error message (Wrong password).
The only way to get the SMBPASSWD to work is to type the full pathway.
Open Terminal and type
sudo /opt/local/bin/smbpasswd -a YOURUSERNAME
You should use your real OS X Lion Username. Press Enter, You will then be need to set the password. after you are done it all worked like a charm! π
Thanxs alot!
Thanks for this. The primary purpose for this workaround was for access without username & password authentication allowing XBMC to connect via SMB. Nice tip though.
now it’s all ok…..work but dont work the “launch agent”…..i have a Mac Pro ….not Imac…..how to modify the file ?
THANK YOU VERY MUCH !!! IT WORKS PERFECTLY !!! π
how to add password in the .plist file ??
I followed all the steps listed and created my shares, however my mac still does not show up in XBMC when I got to Add Source>Windows Network (SMB). My older mac running leopard is there but my macbook with Lion still doesn’t display. Any ideas?
I installed MacPorts from the Lion DMG. Everything went well. But now when I enter in the “sudo port install samba3” command, I get this error:
Warning: No default port source specified in /opt/local/etc/macports/sources.conf, using last source as default
Warning: port definitions are more than two weeks old, consider using selfupdate
Error: Port samba3 not found
To report a bug, see
Any ideas?
@Perry F et al – Make sure you open a support ticket with Apple and tell them what you think – they CAN fix this in future versions, but they have to hear about the problem. It does NOT cost to open a ticket – you have the option to select “I just purchased an operating system”.
You need to add the SMB share manually in XBMC. Click add a share, select SMB as the type and then use the IP address of your Lion mac, or the machine name you setup in smb.conf in the address field. Then when you click OK it will add it asa source.
You’re missing two parts of the macports install process, this is why I like to install via terminal. Firstly you need to add the source to your macports files
“Open /opt/local/etc/macports/sources.conf in a text editor. The last line which should look like this:
rsync://rsync.macports.org/release/ports/
Change it to point to the working copy you checked out:
file:///opt/mports/trunk/dports
and then you need to sync macports with this in terminal
sudo port -d sync
This will update your repository list & list of all sources in your macports, and allow you to install samba 3. Essentially its a file telling macports where to find all the source files online.
I’ve had nothing but success. Thanks so much for this.
Very interesting but I have a slightly different problem. I am trying to connect to a Humax Foxsat HDR (a PVR box running Linux). Samba is installed on the Humax and since upgrading to Lion I can no longer connect using SMB. The Humax is on the same wireless network as my MacBook. Under 10.6 I could see the Humax as a shared device and watch my recorded programmes using VLC.
I have installed Samba 3 as above but how do I use Samba 3 instead of Apple’s crazy implementation ??? I am still getting the same error with Lion as I did before installing Samba 3…
Finally got it working through a combination of automated install and manual Terminal magic. This is so much better than the UPNP software I had to use this last month that froze for like 2 minutes every time I rewound or fast-forwarded anything I was watching.
Thanks very much for this tip!
Somehow nmbd fails to start up:
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
smbd seems to work fine though; can connect to it by using IP number. Any idea what can be wrong?
Danny
I’ve done all the steps and have entered my IP address into XBMC on my Apple TV 2. I can connect to my MacBook PRO but no folders are showing up!
I’ve edited samba to be like this, but nothing shows up. Am i missing something?
;[New!]
; comment = New!
; path = /Users/Lionel/Movies/New!
; available = yes
; guest ok = yes
; create mask = 644
; directory mask = 755
; read only = no
;[Movies]
; comment = Movies
; path = /Users/Lionel/Movies/
; available = yes
; guest ok = yes
; create mask = 644
; directory mask = 755
; read only = no
;[Giant]
; comment = Giant
; path = /Users/Lionel/Movies/Entertainment
; available = yes
; guest ok = yes
; create mask = 644
; directory mask = 755
; read only = no
;[Downloads]
; comment = Giant
; path = /Users/Lionel/Downloads
; available = yes
; guest ok = yes
; create mask = 644
; directory mask = 755
; read only = no
Hi Lionel
For a start you need to remove all the semi colons at the start of each line of your shares, they are used to comment lines out and you don’t want any lines of your shares commented out. This is why your shares aren’t showing up. Secondly I wouldn’t use the ! I your share name as this may cause issues. Thirdly the name in the square bracket should really match the name in the comment. You have named 2 shares Giant in your comments.
Hi John,
thanks for your quick response. It works now except for my external HDD (Giant) that i’m trying to get to show up.
The error message i get id “Error 2: share not available”
Could you take a look to see if there’s something wrong with this code?
[Giant]
comment = Giant
path = /Lionel’s Macbook Pro/Giant/Entertainment
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
Btw, the HDD is formatted in exfat. that shouldn’t have a problem being recognized right? Thanks for your help
thanks very much for this ! my apple tv is useful again !
yay !
Hi John,
I did everything you’ve said, but without success. Everything seemed to work in Terminal, and I used TextWrangler to edit the config files, renamed it etc. Started up the service, but I don’t get any response, my XBMC (on my ATV2) isn’t seeing the share I’ve made;
[Data]
comment = Data
path = /Volumes/Data
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
How can I see if the SMB server is actually running?! I can’t find it running in the tasks list in OSX?!?!
Thanks for your help!
Greetz from Holland,
Jeroen
Do I need to rename or otherwise edit the plist file to get samba3 to automatically run at restarts?
I’m on a Mac mini –
SMB:
NetBIOSName: MAC-MINI
Workgroup: HOME
http://www.johnlarge.co.uk/com.imac.samba3.plist
Hi Lionel,
you should properly escape your path as you have some spaces in it. That should fix it. Or just rename /Lionelβs Macbook Pro/Giant/Entertainment to something like “LionelsMacbookPro/Giant/Entertainment”
Mirko
Hi John,
I just want to say, the way you have helped so many people and continue to do so by sharing your expertise with this blog is really cool.
I can see that you wrote the guide before certain things became easier to install.
Just in summary, my experience has been:
1. Xcode was easy to install from the App store
2. Macports installation was easy from the package installer from the website
3. I went straight to installing Samba3 successfully via terminal using your line:
sudo port install samba3
4. Everything works fine except for the Launchagent
5. I’ve tried various workarounds, even using Lingon as a recent observer commented but I’m wondering whether the problem is I need to type in my password at some point, which is also why I wonder Roger asked on the 26th July?
Can anyone else confirm for me my suspicion that it is a password issue, I need to somehow get the plist file to supply my password as I do when I run the line in Terminal?
If so, is there any way of automating this? I’ve already tried removing the password altogether, and of forcing myself to login with a password when i reboot (rather than using the automatic login). I’ve also tried changing the config from user to server and inserting a server password, but all to no avail.
Many thanks again for the solution you’ve provided. For now, of course the set up works perfectly for me as long as I manually load samba as you warned us.
[iMac 2.66Ghz Intel Core 2 Duo running Lion, several external HDD via FW800 – now all fully accessible by my Beyonwiz DP-P2]
HI John have a question…how is the correct setup for share to multiples device ? actually have just correctly configured Nintendo Wii IP of Wii is 192.168.1.5 …. have assigned @ my notebook this static IP : 192.168.1.8…but …..
Hi there,
thanks for all you help, I’m getting an error message after typing the following command in to terminal:
sudo cd /opt/mports/trunk/base
the message i get is:
/usr/bin/cd: line 4: cd: /opt/mports/trunk/base: No such file or directory
any thoughts? The macports commands seemed to work and there was plenty of installs going on.
Thanks
Thanks Mirko and John for all your help! I can now get all my files (even from my external HDD) to show.
Only challenge remaining now is i need to manually key in the command each time i restart my mac. I can’t seem to get the launchagent plist file to run each time i restart my mac.
Any thoughts? I have even renamed my mac to “imac” to suit your file but it still doesn’t work
Work finally with the following changes, not sure if this is the proper way but it’s working for me. Please comment.
1) Instead of /Library/LaunchAgents, put the plist file in /Library/LaunchDaemons.
2) Remove com.apple.netbiosd.plist in /System/Library/LaunchDaemons as it blocks the port required for the nmbd to be launched.
One more change, instead of getting the command “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” as in one plist. I have to separate them into two plist files, that’s the only way I can make it work. Let me know if there’s any other way.
sudo /opt/local/sbin/smbd -D
sudo /opt/local/sbin/nmbd -D
Also, for the KeepAlive key, it’s better to set it to false or else the command will be called every 10 seconds.
Hi John
Followed your instructions worked ok.
Except when I tried to turn off Lion’s SMB the user will not uncheck so Lion is still using its SMB not samba3 I have just installed. Any idea on how to get around this ?
Thank you
Stuart
I have installed samba3 hoping to get my Boxee to connect..but when i put in the address (smb://imac) it says “Connection Refused”. could there be some permission problem here??
On Lion Client it seems you need to put your .plist (launchagent) in /User/LaunchDaemons then it worked perfectly.
Many thanks!
Hi,
Thx a LOT for this post! It really helped! BUT: I have problems using the “server string” from smb.conf. I only get “Connection refused” when typing “smb://macmini”. It works with IP address though. I can of course use IP, but it would have been great to get server string working also. Can someone point me in the right direction?
Thx,
Morten
Great guide! thx!
I have the same issue as others. I have smbd running, but in nmbd log file I have this error:
mbd version 3.2.15 started.
Copyright Andrew Tridgell and the Samba Team 1992-2009
[2011/08/01 17:55:21, 0] lib/util_sock.c:open_socket_in(1336)
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
I have smb sharing disabled in lion settings, still have AFP sharing on.
Anyone have an idea what the issue might be? System is early 2008 mac pro.
Can someone explain why I got this?:
“sudo: ./configure: command not found”
the most advanced operating system of the world
I’m also running into the password issue for the Launch Agent. I’ve tried piping my password in as such:
echo | sudo -S /opt/local/sbin/smbd -D && sudo -S /opt/local/sbin/nmbd -D
That didn’t work. I also tried modifying my sudoers file to let my username use sudo without a password. No luck there either. I’d really love it if someone smarter than me came up with a solution. I’m shit when it comes to command line wizardry.
That was supposed to say:
echo “password” | sudo -S /opt/local/sbin/smbd -D && sudo -S /opt/local/sbin/nmbd -D
I didn’t realize it would strip angle brackets.
Hi
John, I have the same issue than David:
with nmbd:
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
I don’t know how I can disable Lion smb. I go to settings and I have all share options disabled.
I have this error all the time:
sudo mount_smbfs //192.168.1.1/DiscosUSB /Users/pedro/Volumes/livebox/
mount_smbfs: server connection failed: Unknown error: -5996
I’ve got the same problem as A Jones on July 31, 2011 at 3:47 pm:
“Iβm getting an error message after typing the following command in to terminal:
sudo cd /opt/mports/trunk/base
the message i get is:
/usr/bin/cd: line 4: cd: /opt/mports/trunk/base: No such file or directory.
”
What am I doing wrong?
thanks for your help,
Koen
Having the same issue as David and Pedro
[2011/08/06 00:34:23, 0] lib/util_sock.c:open_socket_in(1336)
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
I believe the problem is the inability to completely turn off smb file sharing in Lion, when migrating files from Snow Leopard:
https://discussions.apple.com/thread/3211072?start=0&tstart=0
followed all the steps successfully.
but I am getting “connection refused” from my XBMC machine trying to access the newly configured Lion SMB server.
I also used the user:password combination which I configured using smbpasswd -a shell command… no avail – still connection refused..
what’s wrong?
Hi
I’m stuck at ‘sudo cd /opt/mports’
This command is not working.
I am getting “connection refused” error on my XBMC machine when I try to access my smb3@lion server.
I did add the matching user/password configure on the XBMC to the smb server using smbpasswd -a user, and then typing the matching password.
all the installation procedure went smoothly and I made sure the smbd process is running… help?
I cannot get this to stick. Every reboot I have to run the command from the terminal window: sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
I have added the plist (renamed for my Mac Mini) and added it to this folder: /Library/LaunchAgents and then I moved it to this folder: /Library/LaunchDaemons
Any suggestions or ideas?
Thanks – WwTIPPYwW
getting these messages too – producing console respawning messages every 10 secondsβ¦
Aug 11 09:16:57 WwTIPPYwW-Mac-mini com.apple.launchd.peruser.501[175] (com.Mac-Mini.samba3launcher[11362]): Exited with code: 1
Aug 11 09:16:57 WwTIPPYwW-Mac-mini com.apple.launchd.peruser.501[175] (com.Mac-Mini.samba3launcher): Throttling respawn: Will start in 10 seconds
I think you also need to perform a
/opt/local/bin/smbpasswd -an nobody
Otherwise guest account nobody will not work.
Hi
I have followed your guide, SAMBA is running.
sources.smb.conf has been modiied with the code below.
[MOVIES]
path = “/Volumes/Macintosh HD 2/MOVIES”
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
Workgroup and server name have also been set.
My Media Player sees the iMac but that is as far as it goes. Nothing can be accessed. BTW the Media player still goes straight in to a shared folder on my Hacbook (10.6.8) without blinking an eye.
Thank you for any suggestions.
Hi there,
i concurr with Pierre Scerri,,
i have SMB running i can connect with the imac.. see the shared folders.. but no acces..
login name and pasw fault.. on the lion machine..
how ever with 10.6.8 machine.. it is working flawless..
thanks any one with suggestions..
It worked! But you need to tell people to add a user and to enable the user if shares are not public (and I do not recommend public shares).
root# /opt/local/bin/smbpasswd -a usernam
New SMB password:
Retype new SMB password:
Added user username.
root# /opt/local/bin/smbpasswd -e username
User enabled
any idea how I can remove all of this (or if I even should) if I decided not to use it? It didn’t fix my specific problem.
Thank you So much for these awesome instructions. Apple TV is working perfectly now with XBMC and Samba3.
Can I uninstall Xcode now? It is taking up so much disc space and If I don’t need it any more I would rather get red of it to reclaim that disc space.
Thank you again. I was so upset that I had upgraded to Lion because it broke my XBMC and Apple TV. But Now I am Up and Running. Finally.
Cheers.
Hi,
First thank you very much for this post. I have managed to install samba3 and modify the smb.conf file but when I am running the last command “sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D” it does not start the server because when I type “smbclient -L GG-SAMBA3” I get Connection to GG-SAMBA3 failed (Error NT_STATUS_BAD_NETWORK_NAME).
The “testparm” run gives the following, global network is WORKGROUP.
testparm smb.conf
Load smb config files from smb.conf
Processing section “[homes]”
Processing section “[printers]”
Processing section “[Downloads]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = GG-SAMBA3
log file = /usr/local/samba/var/log.%m
max log size = 50
dns proxy = No
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /usr/spool/samba
printable = Yes
browseable = No
[Downloads]
comment = Downloads
path = /Users/Jerome/Downloads
read only = No
create mask = 0644
guest ok = Yes
It does not throw any error message, any idea how I can check what is going wrong ?
Cheers,
Jerome
Set user type as “share”, and it should work. Also, you don’t need to use sudo for CD commands. Just do CD “PATH” without the SUDO.
Have you set these options in the smb.conf?
security = share
guest account = nobody
After that my A.C Ryan Player could connect two the smb share without pw.
Hi
Okay! I got it to work. Just one thing – I have to turn Samba on from the terminal every time I boot. The plist is not working.
Thank you so much. After weeks of searching for a solution i finally have my smb shares working again.
Great guide! Not for everyone I guess but managed to get it working pretty easy! π
Perhaps something to mention, if you install Macports with the package installer it also works, and saves some time and makes the procedure somewhat easier.
Anyway, happy to be streaming files to my media player again ! π
Does anyone know if I could uninstall Xcode after I setup Samba3? It’s 7GB and I plan on moving to an SSD soon and that’s way too much space for something I wouldn’t use except for this. Thanks in advance!
If anyone has problems here:
sudo cd /opt/mports
or here:
file:///opt/mports/trunk/dports
You need to point to ~/User/opt, your home folder not your root folder…
Thank you! Great post! Now Samba working better, than new AFP protocol in nightly XBMC.
Thanks for the quick guide π
In my case i had a problem, that’s related with an bug (very old) on macports for samba 3.0.3 (https://trac.macports.org/ticket/30951), it seems when a user is in more than 16 groups, samba was unable to get the group list and fails the authentication check, with the following error:
2011/09/29 22:15:18, 0] lib/system_smbd.c:getgroups_unix_user(171)
get_user_groups: failed to get the unix group list
[2011/09/29 22:15:18, 0] auth/auth_sam.c:check_sam_security(355)
check_sam_security: make_server_info_sam() failed with ‘NT_STATUS_NO_SUCH_USER’
Creating another user seem to solve the problem.
Has anyone tried to make an installable samba package from macports? The installation of Xcode is a major hurdle for mostly everyone and it doesn’t serve any practical purpose for most.
I can’t install macports due to the version of Xcode I’m running, but this should work:
http://guide.macports.org/#using.binaries.binary-packages
People would still need to create the config files but at least the burden of work, compiling the binary, would be taken care of.
Worked perfectly. XMBC is working perfectly again. Thank You!
I have an error message after the configure command, you can help me
sudo cd /opt/mports/trunk/base OK
sudo ./configure –enable-readline Not OK
sudo: ./configure: command not found
Thank u for this guide! It was really great!!!
I had few problem with “permission denied”
I solved all my problems keeping really clear the smb.config:
[global]
workgroup = WORKGROUP
server string = “mac name”
[share folder]
….(follow the above instruction)…
After spending a whole day at this i still cannot get it to work.
I have followed the instructions to the letter and tried all the options posted above.
still will not work. I guess i cannot get SMB to work with Lion.
How do i uninstall all that i have added above.
Thanks! With this article and the add info in the comments about adding a user/password I was able to get access to my Mac from my Kindle Fire to view videos.
I have succesfully installed Samba on Lion. Thank you for your post.
In my case, I don’t have need enter a user or password. I want to say that trying to configure the Samba Shares in XBMC by the (Windows network) option or by scratch doesn’t worked for me. It didn’t find my smb server. I used the Zeroconf and It worked. I selected the computer, the shared directory and It put automatically the url but ADDING A PORT 445. Maybe It use a different port than the default. It works!
After hours and hours on the phone to Mac support, they suggested this linkm to get my OSX Lion MBP and iMac to work with my SMB NAS drive again.
Unfortunately, after following the above and receiving no errors, I still get the “server unsupported” message when trying to connect to my NAS (through finder).
Has anyone got any suggestions that I could try other than reinstalling back to Snow Leopard?!
I too would appreciate some instructions on how to uninstall the above
Would anyone be willing to post some files that we could download for reference? I need SMB to work but afraid this is all a bit over my head.
Like Jerome, I installed the Samba3 server but get the “bad network name error”, when I check the availibility of my Samba-Server.
So when I enter this into Terminal:
rob:/ rob$ smbclient -L rob1
It just says:
Connection to rob1 failed (Error NT_STATUS_BAD_NETWORK_NAME)
This is what testparm says:
rob:/ rob$ testparm
Load smb config files from /opt/local/etc/samba3//smb.conf
Processing section “[homes]”
Processing section “[Downloads]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
server string = rob1
log file = /usr/local/samba/var/log.%m
max log size = 50
printcap name = lpstat
dns proxy = No
hosts allow = 192.168.1., 192.168.2., 127.
[homes]
comment = Home Directories
read only = No
[Downloads]
comment = Downloads
path = /Users/rob/Downloads
valid users = rob
read only = No
create mask = 0644
guest ok = Yes
It doesn’t show up in testparm, but I also set up “security = user” and “guest account = nobody”. I also set up a Samba User called “rob” and enabled it.
What am I doing wrong? I have no clue, the firewall is also off … I will appreciate every hint.
Regards
rob
it’s important to note that when you are done installing and you have built your config that you need to create a local username for samba and you need to do that with your user account on your mac in my example jlloyd but it needs to be a different password then your normal workstation password example foobar. It will work after that.
Also forget the launch thing it never works so run
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
password
enter
Hi There,
If you are like me you probably depended on Samba “SMB” to allow your Popcorn Hour to communicate to your Mac in order to stream your content. If you are reading this message your content is no longer working.
I made 2 short youtube videos for you to watch and get your content back online and working again.
Take some time and watch the video and post any questions you may have.
Part 1 http://youtu.be/O9RvZrCrg1Y
Part 2 http://youtu.be/9FOfeQdMqUY
Watch in Full Screen With 1080p Full Screen if you are having issues with see the font or terminal
Links and info you need
http://www.macports.org/install.php (Mac Ports Lion)
http://itunes.apple.com/us/app/xcode/id448457090?mt=12 (X Code)
Install Notes And Locations
sudo port -d sync
sudo port install samba3
sudo mv /opt/local/etc/samba3/smb.sample.conf /opt/local/etc/samba3/smb.conf
sudo vi /opt/local/etc/samba3
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
server string = maggot
# Security mode. Defines in which mode Samba will operate. Possible
# values are share, user, server, domain and ads. Most people will want
# user level security. See the Samba-HOWTO-Collection for details.
security = user
[Storage]
comment = Storage
path = /Volumes/Storage
available = yes
guest ok = yes
create mask = 644
directory mask = 755
read only = no
cd ~
vi samba.sh
i
sudo /opt/local/sbin/smbd -D && sudo /opt/local/sbin/nmbd -D
:wq!
chmod 755 samba
./samba
sudo killall smbd (This will restart/kill the samba process)
Hi, would be very great full for some help as I got as far as: “sudo port -d sync”
and got this…..
Warning: /opt/local/etc/macports/sources.conf specifies invalid source ‘rsync:file:///opt/mports/trunk/dports [default]’, ignored.
Warning: No default port source specified in /opt/local/etc/macports/sources.conf, using last source as default
can’t read “sources”: no such variable
while executing
“lindex $sources end”
(procedure “mportinit” line 171)
invoked from within
“mportinit ui_options global_options global_variations”
Error: /opt/local/bin/port: Failed to initialize MacPorts, can’t read “sources”: no such variable
As mentioned to John over twitter, I’ve built a free tool to install, uninstall and manage Samba on OS X Lion. It’s called SMBUp and can be found in MacUpdate (I won’t link to it on John’s blog out of deference, I don’t want to look like a spammer π ).
I’m putting this comment here because this post is probably *THE* most linked post on Samba for Lion on the Internet. It sure is the one I used as a reference myself to give to dozens of friends until I decided to take it one step further and make it a fully-fledged tool and installer π (you can see where I was planning to do so on my comment from October above).
Also: To uninstall the macports packages mentioned above you can just run the “port” command with the “uninstall” option:
sudo port uninstall –follow-dependencies samba3
You can delete Xcode by deleting the /Developer folder in your hard drive’s disk (although I wouldn’t recommend either, if you don’t know what you’re doing).
I’m getting an error when launching the nmbd:
bind failed on port 137 socket_addr = 0.0.0.0.
Error = Address already in use
Any help on finding which process is using this?
it does not work for me on 10.7.3 and gives exceptionkeynotfound
when in installed the software it kept on installing samba but never completes, then i had to install it from the image
Works for me good on lion 10.7.3. Little problems with first time connect. Iam using samba for over years so i debug it and it works now.
Problems i saw.
Create smbpasswd -a “macusernaam”. De macusernaam must also exist in passed, so use the same as your system credentials.
set in [global] security=user, this means that username/password is requirement by login.
test your config with command “testparms smb.conf”. This will check if you configured something wrong.
test you config with de built-in smbclient. smbclient -L netbiosname -U macusername.
username is only requirement when use security=user, and you create a existing user thats in passwd and smbpasswd. When netbiosname don’t work, use the IP of the servers. If you get connected your server is working. Maybe you can’t browse the folders on your sharen.
When i connect to dune i connect directly to the folder and it works for me.
name: “name how to display”
Type: SMB
Server: “IP of your SMB server, properly your macbook”
Map: “Shared folder you connect to”
User: “User thats in smbpasswd”
Password: “user password”
Only what not work for me was the automatic start while boot.
thx for de work instruction